package innova.servlet;

import innova.negocio.GestionCentroFormacion;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class CentroFormacionCalcularServlet
 */
@WebServlet("/CentroFormacionCalcularServlet")
public class CentroFormacionCalcularServlet extends HttpServlet {

  private static final long serialVersionUID = 1L;
  
  private GestionCentroFormacion negocio = new GestionCentroFormacion();

  /**
   * @see HttpServlet#HttpServlet()
   */
  public CentroFormacionCalcularServlet() {
    super();
    // TODO Auto-generated constructor stub
  }

  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
   * response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
  }

  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
   * response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
        //Guardando el resultado en memoria
		request.setAttribute("REPORTE_CENTRO_FORMACION", negocio.listar());
		
	    //Retornando a la pagina
	    RequestDispatcher rd = request.getRequestDispatcher("HU10.jsp");
	    rd.forward(request, response);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
  }
}
